import 'package:flutter/cupertino.dart';
import 'package:xindong/common/xindong_sezhi.dart';
import 'package:xindong/routes/tab_home/controller/xindong_tuijian_vm.dart';
import 'package:xindong/routes/tab_home/view/xindong_user_list_cell.dart';
import 'package:xindong/widgets/common/xindong_common_widget.dart';
import 'package:xindong/widgets/container/xindong_empty_container.dart';
import 'package:xindong/widgets/container/xindong_getx_builder_container.dart';
import 'package:xindong/widgets/container/xindong_keep_alive_container.dart';

class XinDongHomeQualityListView extends StatelessWidget {
  const XinDongHomeQualityListView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return XinDongKeepAliveContainer(
      keepAlive: true,
      child: XinDongGetBuilder<XinDongHomeQualityVM>(builder: (viewClass) {
        return XinDongRefreshContainer(
          viewClass: viewClass,
          child: XinDongEmptyContainer(
            dataList: viewClass.dataList,
            emptyTips: "暂无推荐",
            child: ListView.separated(
              controller: viewClass.scrollController,
              itemCount: viewClass.dataList?.length ?? 0,
              itemBuilder: (BuildContext context, int index) {
                final model = viewClass.dataList![index];
                return XinDongUserListCell(model: model);
              },
              separatorBuilder: (BuildContext context, int index) {
                return const SizedBox();
              },
            ),
            // child: GridView.builder(
            //   padding: const EdgeInsets.all(kPaddingValue),
            //   gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
            //     crossAxisCount: 3,
            //     crossAxisSpacing: 8.0, //水平间距
            //     mainAxisSpacing: 8.0, //垂直间距
            //     childAspectRatio: 168.0 / 224, //子Widget宽高比例
            //   ),
            //   itemCount: viewClass.dataList?.length ?? 0,
            //   itemBuilder: (BuildContext context, int index) {
            //     final model = viewClass.dataList![index];
            //     return XinDongUserCardCell(model: model);
            //   },
            // ),
          ),
        );
      }),
    );
  }
}
